<?php
class NewsModel extends Model
{
    protected $_validate=array(
        array("title","require","文章标题不得为空"),
        array("content","require","文章内容不得为空"),
    );

    protected $_auto = array (
        array('status','0'),  // 新增的时候把status字段设置为1
        array('published','getTime',1,'callback'), // 对create_time字段在更新的时候写入当前时间戳
    );

    public function getTime()
    {
        return date("Y-m-d H:i:s");
    }
}

?>